import React, { BaseComponent } from 'react';
import { Button, Toast } from '@ant-design/react-native';

export default class Home extends BaseComponent {

	constructor(props) {
		super(props);
		props.navigation.setParams({ onRightButton: this.onRightButton })
		this.state = {};
	}

	static navigationOptions = (options, screenProps) => {
		const title = 'Home'
		if(!options.navigation.state.params){ return {title: title} }
		const { onRightButton } = options.navigation.state.params
		return {
			title: title,
			headerRight: <Button onPress={onRightButton}> home </Button>
		}
	}

	onRightButton = () => {
		Toast.success('SUCCESS')
	}

	render() {
		return (
			<Button onPress={() => { this.props.navigation.navigate('App_Tabs_2'); }}> home </Button>
		);
	}

}